<?php

class UnitTest extends Assert {
	
	private static $files = array();
	
	public static function copyFile($target, $source)
	{
		self::makeFile($target, file_get_contents($source));
	}
	
	public static function makeFile($filename, $content)
	{
		$oldContent = false;
		if (file_exists($filename))
		{
			$oldContent = file_get_contents($filename);
		}
		
		self::$files[] = array("filename"    => $filename,
		                       "old_content" => $oldContent);
	}
	
	public static function tearDown()
	{
		foreach (array_reverse(self::$files) as $file)
		{
			if ($file["old_content"] !== false)
			{
				file_put_contents($file["filename"], $file["old_content"]);
			}
			else
			{
				unlink($file["filename"]);
			}
		}
		
		self::$files = array();
	}
	
	
}